export default function useAction(emits, loading, finished) {
  function contScroll(e) {
    const sum = e.target.scrollTop + e.target.clientHeight;

    if (loading.value) return;

    if (finished.value) return;

    if (sum >= e.target.scrollHeight - 1) {
      emits('load');
    }
  }

  onMounted(() => {
    emits('load')
  })

  return {
    contScroll,
  }
}